package mc0101.mccache.param;

import mc0101.mccache.util.RedisKeyUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ZcCacheParam {
    @Autowired
    private RedisKeyUtils redisKeyUtils;

    @Value("${cache.outTime.distributeLock:8000}")
    private long lockOutTime;

    @Value("${cache.tryGetTime.distributeLock:10000}")
    private long tryGetLockTime;

    public String getParamKey(String className){
        return redisKeyUtils.getRedisKey("zcCache", className);
    }

    public String getParamVersionKey(){
        return redisKeyUtils.getRedisKey("zcCache", "paramVersion");
    }

    public String getDisturbuteLockKey() {
        return redisKeyUtils.getRedisKey("zcCache", "disturbuteLockKey");
    }

    public String getDisturbuteLockId() {
        return redisKeyUtils.getRedisKey("zcCache", "disturbuteLockId");
    }

    public long getLockOutTime() {
        return lockOutTime;
    }

    public void setLockOutTime(long lockOutTime) {
        this.lockOutTime = lockOutTime;
    }

    public long getTryGetLockTime() {
        return tryGetLockTime;
    }

    public void setTryGetLockTime(long tryGetLockTime) {
        this.tryGetLockTime = tryGetLockTime;
    }
}